package com.kvn.test.stepdefs;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.kvn.test.core.TestContext;
import com.kvn.test.util.SpELUtil;

import cucumber.api.java.en.And;

/**
 * 跨指令的连续参数处理
 * @author wzy on 2017/10/20.
 */
public class SequentialParamStepdefs {
    private Logger logger = LoggerFactory.getLogger(SequentialParamStepdefs.class);
    
    @And("^SAVE_DUBBO->保存返回结果\\$\\{(.*)\\}为场景参数\\{(.*)\\}$")
    public void saveDubbo(String retrieveKey, String saveKey) throws Throwable {
    	// 使用spEL在Dubbo返回结果中取值
    	Object value = SpELUtil.getValue(retrieveKey);
    	TestContext.getInstance().get_S().put(saveKey, value);
    	logger.info("【保存成功】保存返回结果${" + retrieveKey + "}为场景参数{" + saveKey + "}");
    }
}
